<template>
  <div class="page-header-index-wide">
    <a-row :gutter="24">
      <a-card style="margin-left: 10px;margin-right: 10px" title="今日概览">
        <a-row>
          <a-col class="king-col" span="6" style="padding-left: 5px; padding-right: 5px">
            <div class="king-box2 king-bg-yellow">
              <div class="king-flex-vcenter king-space-between">
                <p class="king-num"> {{ evaluationCount }} </p>
                <img src="~@/assets/jjicon.png"></div>
              <div class="king-tit">测评量</div>
            </div>

          </a-col>

          <a-col class="king-col" span="6" style="padding-left: 5px; padding-right: 5px">
            <div class="king-box2 king-bg-blue">
              <div class="king-flex-vcenter king-space-between">
                <p class="king-num"> {{ serviceCount }} </p>
                <img src="~@/assets/jjicon15.16165550.png"></div>
              <div class="king-tit">服务订单数</div>
            </div>

          </a-col>

          <a-col class="king-col" span="6" style="padding-left: 5px; padding-right: 5px">
            <div class="king-box2 king-bg-green">
              <div class="king-flex-vcenter king-space-between">
                <p class="king-num"> {{ doorCount }} </p>
                <img src="~@/assets/jjicon16.2b8d59e2.png"></div>
              <div class="king-tit">预约上门数</div>
            </div>

          </a-col>

          <a-col class="king-col" span="6" style="padding-left: 5px; padding-right: 5px">
            <div class="king-box2 king-bg-yellow">
              <div class="king-flex-vcenter king-space-between">
                <p class="king-num"> {{customizedCount}} </p>
                <img src="~@/assets/jjicon17.5bba4b3c.png"></div>
              <div class="king-tit">定制服务数</div>
            </div>

          </a-col>

        </a-row>

      </a-card>

    </a-row>

    <a-row :gutter="24" style="margin-top: 18px">
      <a-card :loading="loading" :bordered="false" style="margin-left: 10px;margin-right: 10px">
        <a-row>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">营业收费</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h1.png" alt=""></div>
            </div>
          </a-col>
          <a-col span="1"></a-col>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">门诊收费</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h2.png" alt=""></div>
            </div>
          </a-col>
          <a-col span="1"></a-col>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">出诊收费</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h3.png" alt=""></div>
            </div>
          </a-col>
          <a-col span="1"></a-col>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">挂号预约收费</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h4.png" alt=""></div>
            </div>
          </a-col>
        </a-row>

        <a-row style="margin-top: 40px">
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">心血管测评量</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h5.png" alt=""></div>
            </div>
          </a-col>
          <a-col span="1"></a-col>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">门诊客量</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h6.png" alt=""></div>
            </div>
          </a-col>
          <a-col span="1"></a-col>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">出诊客量</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h7.png" alt=""></div>
            </div>
          </a-col>
          <a-col span="1"></a-col>
          <a-col span="5">
            <div  class="statistics-item columnCS">
              <div  class="value">
                <div class="money-text ellipsis" title="￥1,232.37">￥1,232.37</div>
              </div>
              <div  class="title">随访人数</div>
              <div  class="img-wrapper rowCC"><img  src="../../assets/icon_h8.png" alt=""></div>
            </div>
          </a-col>
        </a-row>
      </a-card>
    </a-row>


  </div>
</template>

<script>
import ChartCard from '@/components/ChartCard'
import ACol from 'ant-design-vue/es/grid/Col'
import ATooltip from 'ant-design-vue/es/tooltip/Tooltip'
import MiniArea from '@/components/chart/MiniArea'
import MiniBar from '@/components/chart/MiniBar'
import MiniProgress from '@/components/chart/MiniProgress'
import RankList from '@/components/chart/RankList'
import Bar from '@/components/chart/Bar'
import HeadInfo from '@/components/tools/HeadInfo.vue'

import Trend from '@/components/Trend'
import { getLoginfo, getVisitInfo } from '@/api/api'
import { getAction } from '@api/manage'

export default {
  name: 'IndexChart',
  components: {
    ATooltip,
    ACol,
    ChartCard,
    MiniArea,
    MiniBar,
    MiniProgress,
    RankList,
    Bar,
    Trend,
    HeadInfo
  },
  data() {
    return {
      loading: true,
      center: null,
      barData:[],
      indicator: <a-icon type="loading" style="font-size: 24px" spin />,
      evaluationCount: 0,
      serviceCount: 0,
      doorCount: 0,
      customizedCount: 0,
      idleBed:0,
      refundOut:0,
      toDayFollow:0,
      toDayFollowFinish:0,
      follow:0,
      invalidcustomer:0,
    }
  },
  created() {
    setTimeout(() => {
      this.loading = !this.loading
    }, 1000)
    this.initLogInfo()
  },
  methods: {
    initLogInfo() {
        const that=this;
        getAction('/ch/dashboard/evaluation/count').then((res) => {
          this.evaluationCount = res.result
        }),
        getAction('/ch/dashboard/service/count').then((res) => {
          this.serviceCount = res.result
        }),
        getAction('/ch/dashboard/door/count').then((res) => {
          this.doorCount = res.result
        }),
        getAction('/ch/dashboard/customized/count').then((res) => {
          this.customizedCount = res.result
        })
        getAction('/ch/dashboard/month/list').then((res) => {
          res.result.forEach(function(item, index) {
            that.barData.push({
              x: `${item.key}月`,
              y: item.value*1
            })
          })
        })

    }
  }
}
</script>

<style lang="less" scoped>
.circle-cust {
  position: relative;
  top: 28px;
  left: -100%;
}

.extra-wrapper {
  line-height: 55px;
  padding-right: 24px;

  .extra-item {
    display: inline-block;
    margin-right: 24px;

    a {
      margin-left: 24px;
    }
  }
}

/* 首页访问量统计 */
.head-info {
  position: relative;
  text-align: left;
  padding: 0 32px 0 0;
  min-width: 125px;

  &.center {
    text-align: center;
    padding: 0 32px;
  }

  span {
    color: rgba(0, 0, 0, .45);
    display: inline-block;
    font-size: .95rem;
    line-height: 42px;
    margin-bottom: 4px;
  }

  p {
    line-height: 42px;
    margin: 0;

    a {
      font-weight: 600;
      font-size: 1rem;
    }
  }
}

.king-bg-yellow {
  background: #ffc454;
}

.king-bg-blue {
  background: #6495ed;
}

.king-bg-red {
  background: #fc7778;
}

.king-bg-green {
  background: #4fb591;
}

.king-col {
  margin-bottom: 10px
}

.king-box {
  padding: 10px 15px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  cursor: pointer;
  overflow: hidden
}


.king-box .king-titbox {
  color: #999
}

.king-box .king-titbox .king-icon {
  color: #fff;
  border-radius: 50%;
  padding: 5px;
  background: #6495ed;
  margin-right: 10px
}

.king-box .king-sjbg {
  padding: 5px 10px
}

.king-box .king-num {
  line-height: 24px;
  font-size: 30px;
  font-weight: 700;
  margin: 0;
  margin-bottom: 10px;
  text-align: center;
  height: 24px
}

.king-blue {
  border: 1px solid #d9e7ff;
  border-radius: 5px
}


.king-box2 {
  padding: 10px 15px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  cursor: pointer;
  overflow: hidden;
  border-radius: 5px;
}

.king-box2 img {
  width: 40px;
  height: 40px;
  margin-right: 20px;
}

.king-box2 .king-num {
  font-size: 30px;
  margin: 0;
  color: #fff;
  height: 40px;
}

.king-box2 .king-tit {
  font-size: 18px;
  color: #fff;
  margin: 0;
}

.king-flex-vcenter {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center
}

.king-ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis
}

.king-center {
  text-align: center
}

.king-bg-blue {
  background: #6495ed
}

.king-bg-red {
  background: #fc7778
}

.king-bg-green {
  background: #4fb591
}

.king-bg-yellow {
  background: #ffc454
}

.king-color-blue {
  color: #2989ff
}

.king-color-red {
  color: #fb5c55
}

.king-color-green {
  color: #4fb591
}

.king-color-yellow {
  color: #ffa823
}

.king-space-between {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between
}

.statistics-item {
  position: relative;
  height: 108px;
  padding-left: 90px;
  background: #eff6f8;
  border-radius: 12px;
}
.statistics-item .value{
  margin-bottom: 4px;
  font-size: 20px;
  color: #333;
}

.statistics-item .title {
  font-size: 14px;
  color: #a2aab7;
}
.statistics-item .img-wrapper {
  position: absolute;
  left: 20px;
  height: 100%;
}

.rowCC {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -ms-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.columnCS {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: start;
  -ms-flex-align: start;
  align-items: flex-start;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.money-text {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  max-width: 198px;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-item {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
  width: calc(16.66% - 40px);
  margin: 15px 10px;
}

.summary-item {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  height: 60px;
  padding: 9px;
  cursor: pointer;
  background: #fff;
  border-radius: 11px;
}
</style>